import React from 'react';
import loadjs from 'loadjs';
import { workflowPublicFiles } from '../constants/fileConfig';

export default class BatchSubmit extends React.Component{
    constructor(){
        super();
        this.state = {hasLoad: false};
    }
    componentDidMount(){
        const init = () =>{
            this.setState({hasLoad: true});
        }
        loadjs.isDefined('workflowPublic') ? loadjs.ready('workflowPublic', init) : loadjs(workflowPublicFiles, 'workflowPublic', init);
    }
    render(){
        const { hasLoad ,store} = this.state;
        if(hasLoad){
            const { WfBatchSubmit} = window.weaWorkflowPublic;
            const {onSubmit,visible,onCancel,onSubmitText='',iconClassName = ''} = this.props;
            return (<WfBatchSubmit ecId={`${this && this.props && this.props.ecId || ''}_WfBatchSubmit@rjbgfv`} onSubmit={onSubmit} onCancel={onCancel} visible={visible} onSubmitText={onSubmitText} iconClassName={iconClassName}/>);
        }else{
            return ( <div></div>);
        }
    }
}